import Vue from 'vue'
import Router from 'vue-router'

// 个人中心
const PersonalCenter = r => require.ensure([], () => r(require('@/views/personal-center')), 'admin')
const CigarPersonalCenter = r => require.ensure([], () => r(require('@/views/personal-center/cigar')), 'admin')
const Firmware = r => require.ensure([], () => r(require('@/views/personal-center/firmware')), 'admin')

// 红酒柜设备控制
const DeviceController = r => require.ensure([], () => r(require('@/views/device-controller')), 'admin')

// 雪茄柜设备控制
const CigarDeviceController = r => require.ensure([], () => r(require('@/views/cigar-device-controller')), 'admin')
const CigarCurve = r => require.ensure([], () => r(require('@/views/cigar-curve')), 'admin')

// wifi
const Wifi = r => require.ensure([], () => r(require('@/views/wifi')), 'admin')

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/personalCenter',
      name: 'personalCenter',
      component: PersonalCenter
    },
    {
      path: '/cigarPersonalCenter',
      name: 'cigarPersonalCenter',
      component: CigarPersonalCenter
    },
    {
      path: '/firmware/:device_id',
      name: 'firmware',
      component: Firmware
    },
    {
      path: '/deviceController',
      name: 'deviceController',
      component: DeviceController
    },
    {
      path: '/cigarDeviceController',
      name: 'cigarDeviceController',
      component: CigarDeviceController
    },
    {
      path: '/cigarCurve/:product_id/:device_id',
      name: 'CigarCurve',
      component: CigarCurve
    },
    {
      path: '/wifi',
      name: 'wifi',
      component: Wifi
    }
  ]
})
